<?php

/**
 * This is the model class for table "tbl_api_log".
 *
 * The followings are the available columns in table 'tbl_api_log':
 * @property integer $id
 * @property integer $token_id
 * @property integer $time
 * @property string $content
 */
class ApiLog extends CActiveRecord
{

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_api_log';
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array();
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'token_id' => 'Token_ID',
			'time' => 'Time',
			'content' => 'Content',
		);
	}

	/**
	 * Set some attributes before save
	 */
	protected function beforeSave()
	{
		if ($this->isNewRecord) {
			$this->time = time();
		}
		return parent::beforeSave();
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return ApiLog the static model class
	 */
	public static function model($className = __CLASS__)
	{
		return parent::model($className);
	}
}
